module testapps.Box;

import openglutils.GLArray;
import openglutils.Vector;

public class Box
{
	private GLVertexArray data;
	
	public this()
	{
		data = new GLVertexArray();
		
		data.addVector(Vector3(-1.0f, -1.0f, 1.0f));
		data.addVector(Vector3(1.0f, -1.0f, 1.0f));
		data.addVector(Vector3(1.0f, 1.0f, 1.0f));
		data.addVector(Vector3(-1.0f, 1.0f, 1.0f));

		data.addVector(Vector3(-1.0f, -1.0f, -1.0f));
		data.addVector(Vector3(-1.0f, 1.0f, -1.0f));
		data.addVector(Vector3(1.0f, 1.0f, -1.0f));
		data.addVector(Vector3(1.0f, -1.0f, -1.0f));

		data.addVector(Vector3(-1.0f, 1.0f, -1.0f));
		data.addVector(Vector3(-1.0f, 1.0f, 1.0f));
		data.addVector(Vector3(1.0f, 1.0f, 1.0f));
		data.addVector(Vector3(1.0f, 1.0f, -1.0f));

		data.addVector(Vector3(-1.0f, -1.0f, -1.0f));
		data.addVector(Vector3(1.0f, -1.0f, -1.0f));
		data.addVector(Vector3(1.0f, -1.0f, 1.0f));
		data.addVector(Vector3(-1.0f, -1.0f, 1.0f));

		data.addVector(Vector3(1.0f, -1.0f, -1.0f));
		data.addVector(Vector3(1.0f, 1.0f, -1.0f));
		data.addVector(Vector3(1.0f, 1.0f, 1.0f));
		data.addVector(Vector3(1.0f, -1.0f, 1.0f));

		data.addVector(Vector3(-1.0f, -1.0f, -1.0f));
		data.addVector(Vector3(-1.0f, -1.0f, 1.0f));
		data.addVector(Vector3(-1.0f, 1.0f, 1.0f));
		data.addVector(Vector3(-1.0f, 1.0f, -1.0f));
	}
	
	public void render()
	{
		data.enable();
		data.setPointer();
		data.drawQuads();
		data.disable();
	}
}